package com.example.myapplication;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.widget.Toast;

import com.just.agentweb.AgentWeb;


/**
 * Created by cenxiaozhong on 2017/5/14.
 *  source CODE  https://github.com/Justson/AgentWeb
 */

public class AndroidInterface {

    private Handler deliver = new Handler(Looper.getMainLooper());
    private Context context;
    public interface AndroidInterfaceCallBack{
        public void callBack();
    }
    private AndroidInterfaceCallBack callBack;
    public AndroidInterface( AndroidInterfaceCallBack callBack) {
        this.callBack = callBack;
    }



    @JavascriptInterface
    public void callScan() {

        callBack.callBack();
//        deliver.post(new Runnable() {
//            @Override
//            public void run() {
//
//                Log.i("Info", "main Thread:" + Thread.currentThread());
//                Toast.makeText(context.getApplicationContext(), "" + msg, Toast.LENGTH_LONG).show();
//            }
//        });


        Log.i("Info", "Thread:" + Thread.currentThread());

    }

}
